import Vue from 'vue'
import HomePage from '@/views/HomePage'
import News from '@/views/News'
import Sports from '@/views/Sports'

import SportsPage from '@/views/second/SportsPage'
import Domestic from '@/views/second/Domestic'
import Foreign from '@/views/second/Foreign'
//①引入vue-router 
import VueRouter from 'vue-router'

// ② 让vue使用VueRouter这个插件
Vue.use(VueRouter)


//③创建路由实例
const router = new VueRouter({
  routes: [
    {
      path: '/homepage',
      component:HomePage
    },
    {
      path: '/news',
      component:News
    },
    {
      path: '/sports',
      component: Sports,
      // 二级路由嵌套
      children: [
        {
          path: 'sportspage',
          component:SportsPage
        },
        {
          path: 'domestic',
          component:Domestic
        },
        {
          path: 'foreign',
          component:Foreign
        },
      ]
    },

     ]
})

export default router